package com.yb.module.db.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yb.module.db.domain.DbColumn;
import com.yb.module.db.mapper.DbColumnMapper;
import com.yb.module.db.service.DbColumnService;

@Service
public class DbColumnServiceImpl implements DbColumnService {
	
	@Autowired
	private DbColumnMapper columnMapper;
	
	@Override
	public List<DbColumn> getColumnList(DbColumn column) {
		// TODO Auto-generated method stub
		return columnMapper.getColumnList(column);
	}
	
	@Override
	public DbColumn getColumnDetails(DbColumn column) {
		// TODO Auto-generated method stub
		return columnMapper.getColumnDetails(column);
	}
	
	@Override
	public void addColumn(DbColumn column) {
		columnMapper.addColumn(column);
	}
	
	@Override
	public void updateColumn(DbColumn column) {
		columnMapper.updateColumn(column);
	}
	
	@Override
	public void deleteColumns(String dbName, String tableName, String[] columnNames) {
		for (String columnName : columnNames) {
			columnMapper.deleteColumn(new DbColumn(dbName, tableName, columnName));
		}
	}
}
